You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently LLMAnalytics span machinery supports the case when we spawn a new process and want all spans captured in it to be children of a parent process' span. But in some cases we want spawned process to continue a span that was started in the parent process. For these cases we need an LLMAnalytics.pop_span/1 function. This PR adds it.
💚 How did you test it?
unit tests + my own project
📝 Checklist
I reviewed the submitted code.
I added tests to verify the changes.
I updated the docs if needed.
No breaking change or entry added to the changelog.
test/posthog/llm_analytics_test.exs, line 514-547 (link)
Prefer parameterised tests
The first test ("pops current span from the backlog") and the last test ("custom PostHog instance") exercise the same scenario — starting a span and verifying pop_span returns it — just against different instances (PostHog vs MyPostHog). Per the team's convention these should be collapsed into a single parameterised test that iterates over both instances, which keeps the intent OnceAndOnlyOnce and makes future instance additions trivial.
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/posthog/llm_analytics_test.exs
Line: 514-547
Comment:
**Prefer parameterised tests**
The first test ("pops current span from the backlog") and the last test ("custom PostHog instance") exercise the same scenario — starting a span and verifying `pop_span` returns it — just against different instances (`PostHog` vs `MyPostHog`). Per the team's convention these should be collapsed into a single parameterised test that iterates over both instances, which keeps the intent `OnceAndOnlyOnce` and makes future instance additions trivial.
How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---### Issue 1 of 1
test/posthog/llm_analytics_test.exs:514-547
**Prefer parameterised tests**
The first test ("pops current span from the backlog") and the last test ("custom PostHog instance") exercise the same scenario — starting a span and verifying `pop_span` returns it — just against different instances (`PostHog` vs `MyPostHog`). Per the team's convention these should be collapsed into a single parameterised test that iterates over both instances, which keeps the intent `OnceAndOnlyOnce` and makes future instance additions trivial.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Currently LLMAnalytics span machinery supports the case when we spawn a new process and want all spans captured in it to be children of a parent process' span. But in some cases we want spawned process to continue a span that was started in the parent process. For these cases we need an
LLMAnalytics.pop_span/1function. This PR adds it.💚 How did you test it?
unit tests + my own project
📝 Checklist
If releasing new changes
sampo addto generate a changeset file